package com.hong.chapter6;

public class ThreadCloseGraceful {

    private static class Worker extends  Thread{
        public volatile boolean flag = true;
        @Override
        public void run() {
            while (flag){

            }
        }

        public void shudown(){
            flag = false;
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Worker worker = new Worker();
        worker.start();
        Thread.sleep(1000);
        worker.shudown();
    }
}
